﻿Public Class clsMstList

    Public Function selectByType(type As String, Optional all As Boolean = True) As DataTable
        Dim szSql As String = String.Empty
        szSql &= "SELECT * "
        szSql &= "  FROM sf.t_mst_list "
        szSql &= "  WHERE factory_id =? "
        szSql &= "  AND mst_type = ? "
        If all = False Then
            szSql &= "  AND enabled = true "
        End If
        szSql &= "  ORDER BY mst_type,update_time "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", type)
        If IsNothing(dt) Then
            selectByType = New DataTable
        Else
            selectByType = dt
        End If
    End Function


    Public Function getEmptyLoc(_wareHouseType As String) As DataTable
        Dim szSql As String = String.Empty
        szSql &= "SELECT * "
        szSql &= "  FROM sf.t_mst_list "
        szSql &= "  WHERE factory_id =? "
        szSql &= "  AND mst_type = ? "
        szSql &= "  AND param1 = ? "
        szSql &= "  AND param2 = ? "
        szSql &= "  AND enabled = true "

        szSql &= "  ORDER BY mst_type,update_time "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", "07", _wareHouseType, "0")
        If IsNothing(dt) Then
            getEmptyLoc = New DataTable
        Else
            getEmptyLoc = dt
        End If
    End Function

End Class
